package com.atguigu.gmall.pay.controller;

import com.alipay.api.AlipayApiException;
import com.atguigu.gmall.pay.service.AlipayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Return
 * @Author https://weiranyi.github.io
 * @Date Created in 2022-12-23 14:16
 * http://api.gmall.com/api/payment/alipay/submit/813049062277251073
 * https://open.alipay.com/api/detail?code=I1080300001000041203
 **/

@RequestMapping("/api/payment/alipay")
@RestController
public class PayApiController {
    @Autowired
    AlipayService alipayService;

    @GetMapping("/submit/{orderId}")
    public String payPage(@PathVariable("orderId") Long orderId) throws AlipayApiException {
        // 生成收银台
        String html = alipayService.generatePayPage(orderId);
        return html;
    }


}
